package com.hu.lsp.controller;

import com.hu.lsp.entity.User;
import com.hu.lsp.service.UserService;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * @Author lsp
 * @Date 2020/5/7 10:17
 * @Version 1.0
 */
@RestController
@Slf4j
public class UserController {

   // private static final Logger log = LoggerFactory.getLogger(UserController.class);
    @Autowired
    private UserService userService;

    @RequestMapping("/hello")
    public List<User> index(String id) {
        log.info("ceshi loginfo");
        log.error("ceshi error");
        List<User>  list  = new ArrayList<>();
        User u = userService.selectByPrimaryKey(id);
        User  one =  userService.selectBytestBD(id);
        list.add(one);
        list.add(u);
        return  list;
    }


    @RequestMapping("/updateById")
    public Map<String,Object> updateById(String id) {

        return  userService.updateById(id);
    }


}
